Question: Two of the altitudes of an acute triangle divide the sides into segments of lengths $5,3,2$ and $x$ units, as shown. What is the value of $x$? [asy]
defaultpen(linewidth(0.7)); size(75);
pair A = (0,0);
pair B = (1,0);
pair C = (74/136,119/136);
pair D = foot(B, A, C);
pair E = /*foot(A,B,C)*/ (52*B+(119-52)*C)/(119);
draw(A--B--C--cycle);
draw(B--D);
draw(A--E);
draw(rightanglemark(A,D,B,1.2));
draw(rightanglemark(A,E,B,1.2));
label("$3$",(C+D)/2,WNW+(0,0.3));
label("$5$",(A+D)/2,NW);
label("$2$",(C+E)/2,E);
label("$x$",(B+E)/2,NE);
[/asy]
Solution: Let us label this diagram. [asy]
defaultpen(linewidth(0.7)); size(120);
pair A = (0,0);
pair B = (1,0);
pair C = (74/136,119/136);
pair D = foot(B, A, C);
pair E = /*foot(A, B, C)*/ (52*B+(119-52)*C)/(119);
draw(A--B--C--cycle);
draw(B--D);
draw(A--E);
draw(rightanglemark(A,D,B,1.2));
draw(rightanglemark(A,E,B,1.2));
label("$A$", A, S);
label("$B$", B, S);
label("$C$", C, N);
label("$D$", D, NW);
label("$E$", E, NE);
label("$3$",(C+D)/2,WNW+(0,0.3));
label("$5$",(A+D)/2,NW);
label("$2$",(C+E)/2,E);
label("$x$",(B+E)/2,NE);
[/asy] $\triangle ACE$ and $\triangle BCD$ are similar by AA since they share $\angle ACB$ and $\angle AEC$ and $\angle BDC$ are both right angles and hence congruent.  So $$\frac{CE}{CD} = \frac{AC}{BC}.$$ Plugging in values, we have $$\frac23 = \frac{8}{x+2}.$$ Solving this gives $x+2 = 12,$ or $x = \boxed{10}.$